<!DOCTYPE html>

<html lang="en">
<head>
    <!-- The jQuery library is a prerequisite for all jqSuite products -->
    <script type="text/ecmascript" src="../../../js/jquery.min.js"></script> 
    <script type="text/ecmascript" src="../../../js/jquery-ui.min.js"></script>
    <script type="text/ecmascript" src="../../../js/jquery.multiselect.js"></script>
    <!-- This is the Javascript file of jqGrid -->   
	
    <script type="text/ecmascript" src="../../../js/trirand/src/grid.base.js"></script>
    <script type="text/ecmascript" src="../../../js/trirand/src/grid.common.js"></script>
    <script type="text/ecmascript" src="../../../js/trirand/src/grid.formedit.js"></script>
    <script type="text/ecmascript" src="../../../js/trirand/src/grid.grouping.js"></script>
    <script type="text/ecmascript" src="../../../js/trirand/src/grid.filter.js"></script>
    <!-- This is the localization file of the grid controlling messages, labels, etc.
    <!-- We support more than 40 localizations -->
    <script type="text/ecmascript" src="../../../js/trirand/i18n/grid.locale-en.js"></script>
    <!-- A link to a jQuery UI ThemeRoller theme, more than 22 built-in and many more custom -->
    <link rel="stylesheet" type="text/css" media="screen" href="../../../css/jquery-ui.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="../../../css/jquery.multiselect.css" />
    <!-- The link to the CSS that the grid needs -->
    <link rel="stylesheet" type="text/css" media="screen" href="../../../css/trirand/ui.jqgrid.css" />

    <meta charset="utf-8" />
    <title>jqGrid Loading Data - Toolbar Searching</title>
</head>
<body>

    <style type="text/css">

        /* set the size of the datepicker search control for Order Date*/
        #ui-datepicker-div { font-size:11px; }
        
        /* set the size of the autocomplete search control*/
        .ui-menu-item {
            
        }

         .ui-autocomplete {
            font-size: 11px;
        }       

    </style>
	<label for="search_cells">
		Search Grid: 
	</label>
	<input id="search_cells" type="search"/>
    <table id="jqGrid"></table>
    <div id="jqGridPager"></div>
    <script type="text/javascript"> 
    
        $(document).ready(function () {
			var filter;
            $("#jqGrid").jqGrid({
				
                url: 'data.json',
                mtype: "GET",
                datatype: "json",
                colModel: [
                    {   label : "Order ID",
						//sorttype: 'integer',
						name: 'OrderID', 
						key: true, 
						width: 75 ,
						colmenu : true,
						searchoptions : {
							searchOperMenu : false,
							sopt : ['eq','gt','lt','ge','le']
						}
					},
                    {
						label: "Customer ID",
                        name: 'CustomerID',
                        width: 150,
						hidedlg : true,
                        // stype defines the search type control - in this case HTML select (dropdownlist)
                        // searchoptions value - name values pairs for the dropdown - they will appear as options
                    },
                    { 
						label: "Order Date",
                        name: 'OrderDate',
                        width: 150,
						sorttype:'date',
						formatter: 'date',
						srcformat: 'Y-m-d',
						stype : 'text',
						newformat: 'n/j/Y'
                    },                    
                    {
						label : "Ship Name",
                        name: 'ShipName',
                        width: 150
                    },
                    {
						label: "Freight",
						sorttype: 'number',
						name: 'Freight', 
						width: 150,
						sopt : ['eq']
					}
                ],
				loadonce: true,
				viewrecords: true,
                width: 780,
                height: 250,
                rowNum: 10,
                pager: "#jqGridPager"
            });
			// activate the toolbar searching
			$('#jqGrid').jqGrid('navGrid',"#jqGridPager", {                
                search: false, // show search button on the toolbar
                add: false,
                edit: false,
                del: false,
                refresh: true
            });
			var timer;
			$("#search_cells").on("keyup", function() {
				var self = this;
				if(timer) { clearTimeout(timer); }
				timer = setTimeout(function(){
					//timer = null;
					$("#jqGrid").jqGrid('filterInput', self.value);
				},0);
			});
        });

    </script>

    <!-- This code is related to code tabs -->
    <br />
    <span style="font-size: 12px; font-family: Tahoma">Click on the Tabs below the see the relevant code for the example:</span>
    <br /><br />
    <div id="codetabs" style="width:700px; height: 400px; font-size:65%;"></div>
    <script type="text/ecmascript" src="../../../js/prettify/prettify.js"></script>
    <link rel="stylesheet" href="../../../css/prettify.css" />
        <script type="text/ecmascript" src="../../../js/codetabs.js"></script><script type="text/ecmascript" src="../../../js/themeswitchertool.js"></script>
    
    <script type="text/javascript">

        var tabData =
            [
                { name: "HTML", url: "index.html", lang: "lang-html" },
                { name: "Data", url: "data.json", lang: "lang-json" },
				{ name: "Description", url: "description.html", lang: "lang-html" }
            ];

        codeTabs(tabData);

    </script>
    <!-- End of code related to code tabs -->
</body>
</html>